package day20170424.ch01;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;

import org.junit.Test;

public class PropertiesTest {
	
	/**
	 * 资源文件测试
	 * @throws Exception
	 */
	@Test
	public void propertiesTest() throws Exception {
		//侦察兵
		File file = new File("src/utils/resources.properties");
		//小部队
		InputStream is = new FileInputStream(file);
		//大部队
		Properties properties = new Properties();
		//加载资源文件
		properties.load(is);
		
		//获取到资源文件所有的键
		Set<Object> keySet = properties.keySet();
		//迭代
		Iterator<Object> iterator = keySet.iterator();
		while(iterator.hasNext()){
			System.out.println(properties.get(iterator.next()));
		}
	}
}
